Memory Overview
BindAI Memory provides a provider-based system for storing, retrieving, searching, and managing application memory. Memory is separate from ordinary conversation history. Conversation state belongs to an agent’s conversational execution, whileMemory provides an explicit storage and retrieval layer for records that can persist beyond an individual interaction.
The same Memory abstraction can work with different storage implementations, allowing applications to change providers without changing the basic memory API.
What is Memory?
AMemory object provides access to stored MemoryRecord objects.
A basic example is:
- Namespace
- Memory type
- Metadata
- Importance
- Access information
- Expiration
- Embeddings
- Tags
- Source information
- Relationships
- Timestamps
Memory Architecture
BindAI separates the memory interface from its storage implementation. Conceptually:Memory.
The configured MemoryProvider determines how records are stored and retrieved.
Attaching Memory to an Agent
Memory can be explicitly configured on an agent. Using the current builder API:Memory Providers
BindAI currently provides multiple memory storage implementations. The current provider set includes:InMemoryProviderSQLiteMemoryProviderPostgreSQLMemoryProviderVectorMemoryProviderPineconeMemoryProviderChromaMemoryProvider
MemoryProvider.
The purpose of the provider abstraction is to allow the same memory operations to work across different storage systems.
In-Memory Storage
InMemoryProvider stores records in the running Python process.
- Persistence is not required.
- Tests need isolated storage.
- An application only needs memory for its current process.
- Fast local storage is more important than durability.
SQLite Storage
SQLiteMemoryProvider provides file-backed memory storage using SQLite.
- Local applications
- Development environments
- Prototypes
- Small deployments
- Persistent test environments
PostgreSQL Storage
BindAI also providesPostgreSQLMemoryProvider.
PostgreSQL is appropriate when memory needs to be stored in a shared relational database environment.
A provider can be configured for a PostgreSQL-backed application using the provider’s connection configuration.
Conceptually:
Vector Memory
VectorMemoryProvider provides memory operations that can work with vector representations.
Pinecone Memory
BindAI includesPineconeMemoryProvider for Pinecone-backed memory storage.
Pinecone is useful when memory needs to be stored in a managed vector database.
Conceptually:
Chroma Memory
BindAI also providesChromaMemoryProvider.
Chroma can be used for vector-oriented memory storage in applications that want a dedicated vector database implementation.
Conceptually:
Choosing a Provider
The appropriate memory provider depends on the application’s requirements.
Provider choice should consider:
- Persistence requirements
- Deployment environment
- Search requirements
- Scale
- Operational complexity
- Existing infrastructure
Memory Records
The fundamental unit of memory isMemoryRecord.
A record requires:
keyvalue
namespacetypemetadataimportanceaccess_countlast_accessedexpires_atembeddingscoretagssourcerelationshipsrelated_keyscreated_atupdated_at
Namespaces
Memory records can be organized into namespaces.Memory Types
Memory records have a memory type. The default type islong_term.
For example:
MemoryType for representing memory categories.
Applications can use memory types to distinguish different classes of stored information where appropriate.
Storing Memory
Useset() to store a MemoryRecord.
MemoryResult.
The provider determines how the record is persisted.
Retrieving Memory
Useget() to retrieve a record by key.
Searching Memory
Memory supports search operations. A basic search is:Checking for Memory
Useexists() to determine whether a record exists.
Deleting Memory
Usedelete() to remove a specific record.
Clearing Memory
Useclear() to remove records from a logical memory collection.
Memory Results
Memory operations useMemoryResult for result handling.
Conceptually:
AgentResultToolResult
Memory Lifecycle Management
BindAI includesMemoryManager for managing memory-record lifecycle information.
touch()reinforce()weaken()decay()promote()forget()should_promote()should_forget()set_expiration()clear_expiration()
Importance
Memory records contain animportance value.
For example:
Promotion and Forgetting
The memory manager can determine whether a record should be promoted or forgotten. For example:Expiration
Memory records support expiration. For example:expires_at field.
Expiration is useful for information that should only remain relevant for a limited period.
Examples include:
- Temporary preferences
- Session-related information
- Short-lived application state
- Time-sensitive records
Access Tracking
Memory records track access information. Relevant fields include:Tags
Memory records support tags. For example:Relationships
Memory records can represent relationships with other records. For example:Metadata
Memory records support arbitrary metadata. For example:Embeddings
MemoryRecord supports an optional embedding field.
For example:
Serialization
Memory records can be converted to dictionaries.- Serialize
- Inspect
- Test
- Store in other systems
- Move between application boundaries
Memory Registry
BindAI provides aMemoryRegistry abstraction for registering and resolving memory providers.
Conceptually, a registry maps provider names to provider implementations:
Memory and Execution Context
Memory and execution context represent different kinds of state.
Use
Memory for information that belongs in the application’s memory system.
Use execution context for temporary information needed while an operation is running.
They should not be treated as interchangeable storage mechanisms.
Memory vs Conversation History
Memory is also different from conversation history. Conversation history represents messages exchanged during a conversational interaction. Memory stores explicit records that can be retrieved independently. Conceptually:Memory vs Knowledge
Memory and Knowledge are separate BindAI concepts. Memory stores application memory records. Knowledge is primarily concerned with external information ingestion and retrieval. For example:Memory with Agents
Memory can be combined with the other major agent capabilities. For example:Memory with Workflows
Memory can also be used alongside workflows. A workflow can read memory, perform operations, and write updated records. Conceptually:Memory with Multi-Agent Systems
Multiple agents can use memory as part of a larger application architecture. For example:- A common namespace
- Separate namespaces
- Separate memory providers
- Different record types
- Different authorization boundaries
Resource Management
Memory supports closing its underlying provider.
Provider Selection Guidelines
A practical provider-selection approach is:Use in-memory storage when
- Persistence is unnecessary.
- You are writing tests.
- The application is short-lived.
- Local simplicity is the priority.
Use SQLite when
- Persistent local storage is required.
- A separate database service is unnecessary.
- The application is relatively small.
Use PostgreSQL when
- Multiple processes need shared persistent memory.
- The application already uses PostgreSQL.
- Relational database infrastructure is available.
Use vector-oriented providers when
- Similarity search is important.
- Memory needs semantic retrieval.
- The application has an embedding pipeline.
- Vector storage infrastructure is appropriate.
Best Practices
- Choose a memory provider appropriate for the application’s persistence and retrieval requirements.
- Use namespaces to separate logical memory collections.
- Use
MemoryRecordas the standard memory representation. - Add metadata when records need additional context.
- Use tags to classify records.
- Use relationships when records need explicit links.
- Use expiration for temporary information.
- Use
MemoryManagerfor lifecycle operations. - Track access when memory lifecycle depends on usage.
- Use SQLite when local file-backed persistence is appropriate.
- Use PostgreSQL for shared relational persistence.
- Use vector providers when semantic similarity is required.
- Keep embedding configuration compatible with the selected vector store.
- Protect memory operations with appropriate authorization.
- Do not treat memory as an implicit execution-context store.
- Close providers when they own external resources.
- Test memory behavior independently from model-provider behavior.
Complete Example
The following example uses the currentAgent.builder() API:
Memory abstraction provides access to the records.
The agent receives the memory capability through its configuration.
Summary
BindAI Memory is a provider-based system for storing and retrievingMemoryRecord objects.
The current implementation includes:
MemoryMemoryProviderInMemoryProviderSQLiteMemoryProviderPostgreSQLMemoryProviderVectorMemoryProviderPineconeMemoryProviderChromaMemoryProviderMemoryRecordMemoryResultMemoryManagerMemoryRegistry
- Key-based retrieval
- Search
- Namespaces
- Memory types
- Metadata
- Tags
- Relationships
- Embeddings
- Expiration
- Access tracking
- Lifecycle management
- Serialization
